package com.xindacloud.sms.portal.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xindacloud.sms.portal.dao.SmsUserAllowOperatorMapper;
import com.xindacloud.sms.portal.dto.PricingDTO;
import com.xindacloud.sms.portal.entity.SmsUserAllowOperator;
import com.xindacloud.sms.portal.service.ISmsUserAllowOperatorService;
import com.xindacloud.sms.portal.vo.PricingListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsUserAllowOperatorServiceImpl extends ServiceImpl<SmsUserAllowOperatorMapper, SmsUserAllowOperator> implements ISmsUserAllowOperatorService {

    final SmsUserAllowOperatorMapper userAllowOperatorMapper;

    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
    @Autowired
    public SmsUserAllowOperatorServiceImpl(SmsUserAllowOperatorMapper userAllowOperatorMapper) {
        this.userAllowOperatorMapper = userAllowOperatorMapper;
    }

    @Override
    public IPage<PricingListVO> queryUserPricingPage(PricingDTO pricingDTO) {
        Page<SmsUserAllowOperator> pricingPage = new Page<>(pricingDTO.getCurrentPage(), pricingDTO.getPageSize());
        return userAllowOperatorMapper.selectUserPricingList(pricingPage, pricingDTO);
    }


    @Override
    public List<PricingListVO> downloadPricing(PricingDTO pricingDTO) {
        return userAllowOperatorMapper.downloadUserPricingList(pricingDTO);
    }
}
